package com.chenwei.rabbit.singleQueue;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**rabbit-springboot整合后
 * 简单的直连模式，一个生产者一个队列一个消费者
 * @author: chenwei
 * @date: 2021/4/1 17:46
 */
@RestController("singleProvider")
public class Provider {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @RequestMapping("/singleQueue")
    public void sendMsg(){
        //参数1 队列名称 参数2 发送的 消息
        rabbitTemplate.convertAndSend("singleQueue","singleQueue msg");
    }

}
